<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="${basePath}/public/css/adminbase.css">
    <script type="text/javascript" src="${basePath }/public/js/jquery.min.js"></script>
    <script type="text/javascript" src="${basePath }/public/js/laypage/laypage.js"></script>
    <script type="text/javascript">

        function initData(){
            var pageNum=$("#pageNum")==""||$("#pageNum").val()==undefined?1:$("#pageNum").val();
            var name = $("#Name").val();
            $.ajax({
                url:"${basePath}/admin/work/goodsManage",
                type:"get",
                data:{
                    pageNum:pageNum,
                    name:name
                },
                success:function(resultHtml){
                    $("#tbody").html(resultHtml);
                    var pages=$("#pages").val()==""||$("#pages").val()==undefined?1:$("#pages").val();

                    laypage({
                        cont:'page',//绑定到那个html标签中
                        pages:parseInt(pages),//总页面数
                        curr:pageNum, //当前页码数
                        jump:function (obj,first) {//点击分页按钮触发的事件
                            if (!first){
                                $("#pageNum").val(obj.curr);
                                initData();
                            }
                        }
                    })
                }
            });
        }

        $(function () {
            initData();
        })
    </script>
</head>
<body>

<div class="place">
    <span>位置：</span>
    <ul class="placeul">
        <li><a href="#">产品管理</a></li>
    </ul>
</div>
<div class="session-main">
    <table style="border: 0px;width:100%;">
        <tr>
            <td align="left" width="10%">
                <a href="${basePath}/admin/work/toAdd" class="btn-add"><span><img src="${basePath}/public/images/t01.png"></span>添加</a>
            </td>
            <td  width="90%">
                <ul class="seachform" style="margin-top: 15px;float: right;">
                    <li><label>产品名称</label><input  type="text" id="Name" class="scinput"></li>
                    <li><label>&nbsp;</label><input type="button"class="scbtn" value="查询" onclick="initData()"></li>
                </ul>
            </td>
        </tr>
    </table>
    <table class="tablelist">
        <thead>
        <tr>
            <th width="20%">商品名称</th>
            <th width="5%">商品图片</th>
            <th width="5%">商品货号</th>
            <th width="5%">市场价格</th>
            <th width="5%">出售价格</th>
            <th width="5%">库存数量</th>
            <th width="6%">是否上架</th>
            <th width="15%">添加时间</th>
            <th width="5%">点击数量</th>
            <th width="5%">是否新品</th>
            <th width="5%">分类编号</th>
            <th width="5%">是否热销</th>
            <th width="5%">操作</th>
        </tr>
        </thead>

            <tbody id="tbody">

            </tbody>
    </table>

    <div id="page">

    </div>
</div>

</body>
</html>